<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserBalanceLogTable extends Migration
{
    /**
     * Run the migrations.
     * 用户余额流水
     * @return void
     */
    public function up()
    {
        Schema::create('user_balance_log', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->tinyInteger('amount_type')->default(0)->comment('产品类型(1投资产品2下级产品3投入数量)');
            $table->tinyInteger('type')->default(0)->comment('下级产品(0提现返佣金，1结算返佣金，2申请出佣金，3申请出佣金不通过)');
            $table->decimal('before_amount',16,4)->comment('处理前余额');
            $table->decimal('now_amount',16,4)->comment('需处理余额');
            $table->decimal('after_amount',16,4)->comment('处理后余额');
            $table->string('remarks')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_balance_log');
    }
}
